package com.huawei.codearts.model;


import java.sql.ResultSet;
import java.sql.SQLException;

public class User {

    private long id;
    private String user;
    private String name;
    private long createTime;
    private String createTimeFormat;

    public User() {}

    public User(long id, String user, String name, long createTime) {
        this.id = id;
        this.user = user;
        this.name = name;
        this.createTime = createTime;
    }


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public String getCreateTimeFormat() {
        return createTimeFormat;
    }

    public void setCreateTimeFormat(String createTimeFormat) {
        this.createTimeFormat = createTimeFormat;
    }

    @Override
    public String toString() {
        return "MemberRepository{" +
                "id=" + id +
                ", user='" + user + '\'' +
                ", name='" + name + '\'' +
                ", createTime='" + createTime + '\'' +
                ", createTimeFormat='" + createTimeFormat + '\'' +
                '}';
    }

    public static User fromResultSet(ResultSet rs) throws SQLException {
        return new User(
                rs.getInt("id"),
                rs.getString("user"),
                rs.getString("name"),
                rs.getLong("createtime")
        );
    }

}
